package com.blue.prepose.service.impl;

import com.blue.prepose.entity.PaymentPay;
import com.blue.prepose.dao.PaymentPayDao;
import com.blue.prepose.service.PaymentPayService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 支付表(PaymentPay)表服务实现类
 *
 * @author xiaoyiming
 * @since 2020-05-08 23:29:15
 */
@Service
public class PaymentPayServiceImpl implements PaymentPayService {
    @Resource
    private PaymentPayDao paymentPayDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public PaymentPay queryById(Long id) {
        return this.paymentPayDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
    @Override
    public List<PaymentPay> queryAllByLimit(int offset, int limit) {
        return this.paymentPayDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param paymentPay 实例对象
     * @return 实例对象
     */
    @Override
    public PaymentPay insertSelective(PaymentPay paymentPay) {
        this.paymentPayDao.insertSelective(paymentPay);
        return paymentPay;
    }

    /**
     * 修改数据
     *
     * @param paymentPay 实例对象
     * @return 实例对象
     */
    @Override
    public PaymentPay update(PaymentPay paymentPay) {
        this.paymentPayDao.update(paymentPay);
        return this.queryById(paymentPay.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long id) {
        return this.paymentPayDao.deleteById(id) > 0;
    }
}